package org.ne.springboot;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test;
import org.ne.springboot.service.ImageCheckService;
import org.ne.springboot.service.TableCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.IOException;
import java.util.List;

/**
 * @author luolinila
 * @date 2025/9/3 17:15
 */
@SpringBootTest
public class ImageAndTableFomartText {
    @Autowired
    private ImageCheckService imageCheckService;
    @Autowired
    private TableCheckService tableCheckService;


    @Test
    public void imageAndTableFormat() {
        try {
            XWPFDocument doc = new XWPFDocument( OPCPackage.open("李文波毕业论文.docx"));
            //imageUrls
            List<String> imageCheck = imageCheckService.checkImageContent(doc);
            List<String> tableCheck = tableCheckService.checkTableContent(doc);
            for (String s : imageCheck) {
                System.out.println(s);
            }
            for (String s : tableCheck) {
                System.out.println(s);
            }
        } catch (InvalidFormatException | IOException e) {
            throw new RuntimeException(e);
        }
    }


}
